<script setup >
import { ref } from 'vue'

const props=defineProps({
  pic: {
    type: String,
    required: true,
  },
  price: {
    type: Number,
  },
  title: {
    type: String,
    required: true,
  },
  dis: {
    type: Number,
    required: true,
  },
});

</script>

<template>
  <div > 
    <dl>
      <dt>
        <img class="image" :src="props.pic" alt="">
      </dt>
      <dd>
        <span class="van-multi-ellipsis--l2">{{ props.title }}</span>
        <div>
          <span class="np"> ￥{{Math.ceil(props.price * props.dis)  }}</span>
          <span class="rp"> {{ props.price }}</span>
        </div>
        <van-button>马上抢</van-button>
      </dd>
    </dl>
  </div>
</template>


<style scoped lang="scss">
$size: 0.5rem;
$font-color: white;
$color: rgb(254, 205, 71);

dl {
  width: 4.3rem;
  height: 7rem;
  // border: 1px solid salmon;
  dt {
    width: 100%;
    height: 45%;
    position: relative;
    
    .image {
      width: 100%;
      height: 100%;
      display: block;
      width: 100%;
      background-color: rgb(103,110 ,224 );
    }

  }

  dd {
    height: 50%;
    padding: 8px 8px 3px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    // border: 1px solid salmon;
    span {
      font-size: $size;
    }

    div {
      font-size: $size;
      // height: 50%;
      .np{
        color: $color;
        margin-right: 8px;
      }
      .rp{
        color: gray;
        text-decoration: line-through;
      }
    }

    button {
      width: 100%;
      background-color: $color;
      font-size: $size;
      color: $font-color;
      box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.3);
      height: 30%;
    }

  }
}
</style>
